#ifndef SGUT_TEST_H
#define SGUT_TEST_H

#include <sgu-0/sgu.h>
#include "frame.h"

#define PF __PRETTY_FUNCTION__

#define CHECKINT(X,F) checkint(PF,#X,#F,X,F)
#define CHECKREAL(X,F) checkreal(PF,#X,#F,X,F)
#define CHECKBOOL(X,F) checkbool(PF,#X,#F,X,F)
#define CHECKSTRING(X,F) checkstring(PF,#X,#F,X,F)

using namespace SGU;

class Test : NoCopy
{
	public:
	Test() {_fail = false;}
	virtual ~Test() {}

	virtual void check() = 0;
	virtual void users() = 0;
	virtual void bench() = 0;

	bool isFail() const {return _fail;}

	static std::string nocolon(const std::string &);

	protected:

	void checkint(const char * f, const char * expectedname, const char * effectivename, int  expected, int  effective);
	void checkreal(const char * f, const char * expectedname, const char * effectivename, real expected, real effective);
	void checkbool(const char * f, const char * expectedname, const char * effectivename, bool expected, bool effective);
	void checkstring(const char * f, const char * expectedname, const char * effectivename, const std::string & expected, const std::string & effective);

	private:
	bool _fail;

};



template <typename T> class TestReg : NoCopy
{
	public:
	TestReg(Frame & f) {f.add(new T());}
	virtual ~TestReg() {}
};

#endif
